package com.hunliji.monitor.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hunliji.monitor.dao.mapper.wedding.CustomerInformationMapper;
import com.hunliji.monitor.dao.model.dataobject.AlertChatBindDO;
import com.hunliji.monitor.dao.model.dataobject.CustomerInformationDO;
import com.hunliji.monitor.service.api.CustomerInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * 客资
 * @author wuchen
 */
@Service
public class CustomerInfoServiceImpl implements CustomerInfoService {
    @Resource
    private CustomerInformationMapper customerInformationMapper;
    @Override
    public Integer countByDate(Date startDate, Date endDate) {
        LambdaQueryWrapper<CustomerInformationDO> queryWrapper = new LambdaQueryWrapper<CustomerInformationDO>();
        queryWrapper.eq(CustomerInformationDO::getDeleted,Boolean.FALSE);
        if(Objects.nonNull(startDate)){
            queryWrapper.ge(CustomerInformationDO::getDbCreatedAt,startDate);
        }
        if(Objects.nonNull(endDate)){
            queryWrapper.lt(CustomerInformationDO::getDbCreatedAt,endDate);
        }
        Integer count = customerInformationMapper.selectCount(queryWrapper);
        return count;
    }
}
